package com.example.travelservlet.focus.controller;

import com.example.travelservlet.entity.LikeDto;
import com.example.travelservlet.entity.User;
import com.example.travelservlet.focus.service.UserFocusService;
import com.example.travelservlet.user.domain.Result;
import com.example.travelservlet.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yxj
 * @date 2023/5/24 8:20
 */
@RestController
@RequestMapping("/focusController")
public class UserFocusController {

    @Autowired
    private UserFocusService userFocusService;

    @GetMapping("/findById/{userId}")
    public User findById(@PathVariable String userId) {
        User user = userFocusService.findById(userId);
        return user;
    }

    @GetMapping("/findFocus/{userId}")
    public List<String> findFocus(@PathVariable String userId) {
        List<String> focusId = userFocusService.findFocusId(userId);
        return focusId;
    }

    @GetMapping("/findSome/{userId}/{text}")
    public List<User> findSome(@PathVariable String userId, @PathVariable String text) {
        List<User> focusSome = userFocusService.findSome(userId, text);
        return focusSome;
    }

    @GetMapping("/findSomeFans/{userId}/{text}")
    public List<User> findSomeFans(@PathVariable String userId, @PathVariable String text) {
        List<User> focusSome = userFocusService.findSomeFans(userId, text);
        return focusSome;
    }


    @GetMapping("/findFocusUserByUserId/{userId}")
    public List<User> findFocusUserByUserId(@PathVariable String userId){
        List<User> focusUserByUserId = userFocusService.findFocusUserByUserId(userId);
        return focusUserByUserId;
    }

    @GetMapping("/findFansById/{userId}")
    public List<User> findFansById(@PathVariable String userId){
        List<User> fansById = userFocusService.findFansById(userId);
        return fansById;
    }

    @GetMapping("/deleteFocus/{userId}/{focusUserId}")
    public Integer deleteLike(@PathVariable String userId,@PathVariable String focusUserId){
        Integer integer = userFocusService.deleteFocus(userId, focusUserId);
        return integer;
    }

    @GetMapping("/addFocus/{userId}/{focusUserId}")
    public Integer addLike(@PathVariable String userId, @PathVariable String focusUserId){
        Integer integer = userFocusService.addFocus(userId, focusUserId);
        return integer;
    }

}
